<template>
  <div class="vehicle-details-wrap">
    <div class="box">
      <TopFilter ref="searchOrdersPanel" :list="searchOrdersList" :isSubmitBtn="true" :cols="4" :label-width="90" @filterChange="changeHandle" @onCollapse="collapseHandle" />
      <!-- <el-row>
        <el-button @click="query" type="primary" >查 询</el-button>
        <el-button @click="reset" >重 置</el-button>
      </el-row> -->
      <!--  :loading="addBtnState" -->
    </div>
    <FilterTable
      ref="table"
      :columns="columns"
      columnsRef="part_report_fibPartInfomation_main"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :isSelectColumn="false"
      selectionType="multiple"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="arr => (this.onChangeColumn = arr)"
    >
      <template slot="controls">
        <!-- <el-button @click="openPayments" type="primary" >收 款</el-button> -->
      </template>
    </FilterTable>
  </div>
</template>

<script>
import moment from 'moment';
import { dictionary } from '@/utils/dictMixin';
import { getUserListSelect, queryPartFibInfoReport, getAllUser } from '@/api/part/report/partreport';

export default {
  name: 'vehiclesDaily',
  components: {},
  mixins: [dictionary],
  data() {
    // this.dmsFunc = { dmsFuncId: 55100010 };
    this.arrayTypes = ['MULTIPLE_SELECT'];
    return {
      searchOrdersList: this.createSearchOrdersList(),
      columns: this.createTableColumns(12151001),
      fetchParams: { xhrAbort: true },
      fetchApi: queryPartFibInfoReport,
      handleType: '',
      onChangeColumn: []
    };
  },
  computed: {},
  watch: {},
  mounted() {
    // this.query()
    this.initSelect();
  },
  methods: {
    async initSelect() {
      // 服务顾问
      const res = await getUserListSelect();
      const restech = await getAllUser();
    },
    createSearchOrdersList() {
      return [
        {
          type: 'INPUT',
          label: '配件代码',
          fieldName: 'partNo'
        },
        {
          type: 'INPUT',
          label: '配件名称',
          fieldName: 'partName'
        },
        {
          type: 'INPUT',
          label: '加价组',
          fieldName: 'group'
        }
      ];
    },
    createTableColumns(queryType) {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '配件代码',
          dataIndex: 'PART_NO',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        },
        {
          title: '配件名称',
          dataIndex: 'PART_NAME',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        },
        {
          title: '类型',
          dataIndex: 'PART_TYPE',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('5000'),
          render: params => {
            return <span>{this.createDictText(params.row.PART_TYPE, '5000')}</span>;
          }
        },
        {
          title: '组件类型',
          dataIndex: 'COMMPONENT_TYPE',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '序列参数文件',
          dataIndex: 'SEQUENCE_PARA_FILE',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        },
        {
          title: '加价组',
          dataIndex: 'GROUP_MARK',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        },
        {
          title: '是否在EOP',
          dataIndex: 'IS_EOP',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [
            { text: '是', value: '1' },
            { text: '否', value: '0' }
          ],
          render: params => {
            return <span>{params.row.IS_EOP == '1' ? '是' : '否'}</span>;
          }
        }
      ];
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.$refs.table.$refs.pageTable.EXECUTE_RESET_HEIGHT();
      });
    },
    async getReceiveDetail(id) {
      const res = await getReceiveDetail(id);
      // console.log(res,'结清')
      this.showWriteOff = true;
      this.$nextTick(() => {
        this.$refs.writeOff.openModel(this.onChangeColumn, res.data);
      });
    },
    changeHandle(val) {
      console.log(val);
      this.fetchParams = Object.assign({}, val);
    }
  }
};
</script>

<style lang="less"></style>
